package com.epam.javalab.giorgadze.task2.entity;

import java.util.ArrayList;
import java.util.List;

public class Paragraph implements SentencePart<Sentence> {
    private List<Sentence> sentenceList = new ArrayList<Sentence>();

    public List<Sentence> getSentenceList() {
        return sentenceList;
    }

    public void setSentenceList(List<Sentence> sentenceList) {
        this.sentenceList = sentenceList;
    }

    public Paragraph(List<Sentence> sentenceList) {
        this.sentenceList = sentenceList;
    }

    public Paragraph() {
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Paragraph paragraph = (Paragraph) o;

        if (sentenceList != null ? !sentenceList.equals(paragraph.sentenceList) : paragraph.sentenceList != null)
            return false;

        return true;
    }

    @Override
    public int hashCode() {
        return sentenceList != null ? sentenceList.hashCode() : 0;
    }

    @Override
    public String toString() {
        return "\nParagraph: " + sentenceList;
    }

    @Override
    public void add(Sentence element) {
        sentenceList.add(element);
    }

    @Override
    public void remove(Sentence element) {
        sentenceList.remove(element);
    }
}
